<?php

use yii\helpers\Html;
use yii\bootstrap\BootstrapAsset;
BootstrapAsset::register($this);
$this->title = '详情';
use backend\assets\PrintAsset;
PrintAsset::register($this);
?>



<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
            <?= Html::a('返回','javascript:history.back(-1)'); ?>  <?= Html::encode($this->title) ?>
        </header>
<div class="row" id="printarae">
    <div class="col-md-10 col-md-offset-1">
        <table class="table table-hover">
            <tbody>
            <tr>
                <th>
                    仔猪编号
                </th>
                <th>
                    批次
                </th>
                <th>
                    农户
                </th>
                <th>
                    负责人
                </th>
            </tr>

            <?php foreach ($list as $key => $row)  {?>
                <tr>
                    <td>
                        <a target="_blank" href="/business/pig/view?id=<?=$row['id']?>"><?= $row['no'] ?></a>
                    </td>
                    <td>
                        <?= $row['batch'] ?>
                    </td>
                    <td>
                        <?= $row['liveryname'] ?></a>
                    </td>
                    <td>
                        <?= $row['headperson'] ?>
                    </td>
                </tr>
            <?php } ?>
            </tbody>
        </table>
    </div>
</div>
<button id="print" class="btn btn-primary" style="margin-left:45px;">打印</button>

    </section>
</section>

<script>

    <?php $this->beginBlock('ddd') ?>

    //打印
    $(function(){
        $("#print").printPreview({
            obj2print:'#printarae',
            width:'810'
        });
    });
    <?php $this->endBlock('ddd') ?>
    <?php $this->registerJs($this->blocks['ddd'],\yii\web\View::POS_END) ?>
</script>

